package com.example.demo.controller;

import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import javafx.geometry.Pos;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-01-10
 * Time: 21:25
 */

@RequestMapping("/web")
public class WebController {

    @RequestMapping(value = "/hi",method = RequestMethod.GET)
    public String sayHi() {
        return "hello,world";
    }

    @RequestMapping("/testdemo1")
    public void testdemo1(HttpServletRequest req, HttpServletResponse resp) {
         req.getParameter("name");
    }

    @RequestMapping("/testdemo2")
    public Object testdemo2(String name) {
        return "name";
    }

    @RequestMapping("/testdemo3")
    public Object testdemo3(String name,Integer age) {
        return "name  : " + name + " age : " + age ;
    }

}